﻿using System;

namespace Cpu6502.Opcodes
{
    class INX : Opcode
    {
        public INX()
        {
            this.CpuCycles = 2;
            this.AddressType = CPU.AddressType.Implied;
        }

        public override void Execute()
        {
            CPU.Registers.X++;
            // Set the Zero Flag if the data is 0
            CPU.Registers.P.Z = (CPU.Registers.X == 0);

            // If bit 7 of register is set, then Negative flag must be set.
            CPU.Registers.P.N = (((CPU.Registers.X << 7) & 1) != 0);
        }
    }
}
